package br.unifor.cct.mia.coevolution.evaluate;

import java.io.File;
import java.io.IOException;
import java.util.List;

import br.unifor.cct.mia.coevolution.InvalidTypeException;
import br.unifor.cct.mia.coevolution.evaluate.util.FullConverter;
import br.unifor.cct.mia.coevolution.memory.SharedMemory;
import br.unifor.cct.mia.dataenhancement.Database;
import br.unifor.cct.mia.dataenhancement.Structure;
import br.unifor.cct.mia.dataenhancement.Tuple;

public class EvaluateUtils {

    public static synchronized File memoryToFile(SharedMemory memory, 
                                                 String fileName, 
                                                 Structure struc, 
                                                 Database db, 
                                                 Tuple tuple,
                                                 List positions,
                                                 int nBits) throws IOException, 
                                                                     InterruptedException, 
                                                                     InvalidTypeException {

        if (memory == null || memory.getSize() == 0) {
            return null;
        } else {
            return new FullConverter().convert(fileName,struc,db,memory,tuple,positions,nBits);
        } 
    }
}
